
public class Attribute implements Cloneable
{
	final static public int OFF = 0;
	final static public int ON = 1;
	final static public Attribute CurrentHitPoints = new Attribute("CurrentHitPoints", 0, true);
	final String name;
	volatile int value;
	final boolean visibleForOthers;
	
	/*
	 * "must be" attributes:
	 * =============================
	 * 	"Sight" - range of sigth in metres, larger than 0
	 * 	"Invisible" - 0 or 1; 0 when player is visible for other, 1 when invisible is activated
	 *  "CurrentHitPoints" - 0 to "MaxHitPoints"
	 *  "MaxHitPoints" - larger than 0
	 */
	
	public Attribute(String name_, int value_, boolean visibility)
	{
		name = name_;
		value = value_;
		visibleForOthers = visibility;
	}
	
	public void setEffect(int effect)
	{
		value += effect;
	}
	
	public int getValue()
	{
		return value;
	}
	
	public boolean equals(Object object)
	{
		Attribute rv = (Attribute)object;
		if(rv == null)
		{
			return false;
		}
		return name.equals(rv.name);
	}
	
	public Attribute clone()
	{
		return new Attribute(name, value, visibleForOthers);
	}

	public String toString()
	{
		return new String(name + ";" + value + ";" + visibleForOthers);
	}
	


}

